package cn.ddiancan.xddcloud.common.exception;

/**
 * 业务异常
 *
 * @author Zeki
 */
public class ServiceException extends RuntimeException {

    /**
     * 序列化UID
     */
    private static final long serialVersionUID = 5139428780915818774L;

    public ServiceException(Integer runtimeExceptionCode, String runtimeExceptionMessage) {
        this.runtimeExceptionCode = runtimeExceptionCode;
        this.runtimeExceptionMessage = runtimeExceptionMessage;
    }

    public <E extends ExceptionInterface> ServiceException(E exceptionEnum) {
        this.runtimeExceptionCode = exceptionEnum.getErrorCode();
        this.runtimeExceptionMessage = exceptionEnum.getErrorMessage();
    }

    /**
     * 错误码
     */
    private int runtimeExceptionCode;

    /**
     * 错误内容
     */
    private String runtimeExceptionMessage;

    public int getRuntimeExceptionCode() {
        return runtimeExceptionCode;
    }

    public void setRuntimeExceptionCode(int runtimeExceptionCode) {
        this.runtimeExceptionCode = runtimeExceptionCode;
    }

    public String getRuntimeExceptionMessage() {
        return runtimeExceptionMessage;
    }

    public void setRuntimeExceptionMessage(String runtimeExceptionMessage) {
        this.runtimeExceptionMessage = runtimeExceptionMessage;
    }
}
